<%@ page language="java" %>
<%@ page import="java.util.List,
                java.util.ArrayList,
                java.util.HashMap,
                com.scalar.chiptrack.commons.Constants,
                com.scalar.chiptrack.commons.SessionKeys,
                com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.users.Functionality,
                com.scalar.chiptrack.sales.LineItem,
                com.scalar.chiptrack.operations.packingslip.CustomerShippingLineItem,
                com.scalar.chiptrack.operations.packingslip.forms.PackingSlipForm,
                com.scalar.chiptrack.utils.ConfigManager,
                com.scalar.chiptrack.utils.StringUtils"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/dropShipmentPS.do"/>

<html:html locale="true">
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<%
    String salesOrderIdFromRequest = request.getParameter ("salesOrderId");
    if (salesOrderIdFromRequest == null) {
        salesOrderIdFromRequest = "-1";
    }

    boolean viewPackingSlip = false;
    if ("viewPackingSlip".equalsIgnoreCase((String)request.getAttribute("action"))) {
        viewPackingSlip = true;
    }
%>


<SCRIPT language="JavaScript">
function openInventory (mktPartNumber, lineItemId, fieldName, fieldName1, csLineItemId, quantityToBeShipped, requestedQty, prevQtyShipped, index)
{
	//Bhaskar added this if condition on 7 Jan 2004.
	var pa = document.getElementById("txtErrMsg1");
	var msg = '';
	pa.innerHTML = msg;
	var tempVariable = eval( 'document.dropShipmentPSForm.quantityShipped1_'+index );
	var tempVal = tempVariable.value;

	if( checkInteger(tempVal,"Quantity to Be Shipped","N")==false )
	{
		msg = 'Please enter only positive integer values';
		pa.innerHTML = msg;
		return;
	}

	if ( parseInt (tempVal.trim()) < 0 )
	{
		msg = 'Please do not enter any negative values';
		pa.innerHTML = msg;
		return;
	}

	if ( parseInt(prevQtyShipped) < parseInt(tempVal))
	{
		msg = 'You cannot pull more than stipulated quantity';
		pa.innerHTML = msg;
		return;
	}

	else if ( parseInt(prevQtyShipped) > parseInt(tempVal))
	{
		prevQtyShipped = tempVal;
	}

	
	if (checkBoxValidation(fieldName)==true)
    {
		var locId = document.dropShipmentPSForm.shippingFromLocationId.value;
        var finalInventoryURL = '<%=chipTracContext%>/finalInventory.do?mktPartNumber=' + mktPartNumber + '&lineItemId=' + lineItemId + '&fieldName=' + fieldName + '&fieldName1=' + fieldName1 + '&csLineItemId=' + csLineItemId + '&quantityToBeShipped=' + quantityToBeShipped + '&requestedQty=' + requestedQty + '&prevQtyShipped='+ prevQtyShipped +  '&issedPackingSlip=<%=viewPackingSlip%>&openOrIssued=<%=request.getParameter("action")%>&locId= '+locId+'&dropShipment=true';

		newWindow = window.open (finalInventoryURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=900,height=450,resizable=yes');
        newWindow.focus();
    }
}

function checkBoxValidation( fieldName )
{
     var i=fieldName.substr(16,1);
     var msg = eval('document.dropShipmentPSForm.select_'+i+'.checked');

    if (msg==false)
    {
        document.dropShipmentPSForm.txtErrMsgDetail.value='Please select a check box for inventory';
        return false;
    }
    else
    {
        document.dropShipmentPSForm.txtErrMsgDetail.value="";
        return true;
    }
}

function generatePackingSlip()
{
	var pa = document.getElementById("txtErrMsg1");
	document.dropShipmentPSForm.txtErrMsg.value = '';
	pa.innerHTML = '';
	var flag=true;
	// var index = -1;
	/*if ( document.dropShipmentPSForm.weight.value.trim() == '' )
	{
		document.dropShipmentPSForm.txtErrMsg.value = 'Weight cannot be blank';
		document.dropShipmentPSForm.weight.focus();
		flag = false;
	}*/

	if ( document.dropShipmentPSForm.shippingFromLocationId.value.trim() == '-1' )
	{
		document.dropShipmentPSForm.txtErrMsg.value = 'Shipping Location cannot be blank. Please select one location';
		document.dropShipmentPSForm.shippingFromLocationId.focus();
		location = "#top";
		return;
	}
	
	var tempFlag = false;

	for( i=0 ; i <= document.dropShipmentPSForm.lineItemCount.value-1 ; i++ )
	{
		if( eval( 'document.dropShipmentPSForm.select_'+i+'.checked') == true )
		{
			tempFlag = true;
		}
		else
		{
			var quanty = eval('document.dropShipmentPSForm.quantityShipped1_'+i);
			if (quanty.value.trim().length > 0)
			{
				if ( parseInt(quanty.value) > 0 )
				{
					pa.innerHTML = 'Please select line item '+
						eval('document.dropShipmentPSForm.lineItemNumber_'+i+'.value')+' for selected Inventory';
					location = "#top" ;
					return;
				}
			}
		}
	}

	if ( !tempFlag )
	{
		//if ( parseInt (tempVar) == -1 )
		//{
			//document.dropShipmentPSForm.txtErrMsg1.value="Please select atleast one lineitem";
			pa.innerHTML = "Please select a check box for inventory";
			location = "#top" ;
			return;
		//}
	}
	tempFlag = false;

	for( i=0; i <= document.dropShipmentPSForm.lineItemCount.value-1 ; i++ )
	{
		if( eval( 'document.dropShipmentPSForm.select_'+i+'.checked') == true )
		{
			var qtyShpd = eval('document.dropShipmentPSForm.quantityShipped1_'+i);
			if ( isInteger ( qtyShpd.value ) == false )
			{
				tempFlag = true;
				qtyShpd.value = "0";
			}
		}
	}

	if ( tempFlag )
	{
		//document.dropShipmentPSForm.txtErrMsg1.value="Quantity Shipped must be a integer";
		pa.innerHTML = "Quantity Shipped must be a integer";
		location = "#top" ;
		return;
	}

	tempFlag = true;
	var message = "";

	for( i=0 ; i <= document.dropShipmentPSForm.lineItemCount.value-1 ; i++ )
	{
		if( eval( 'document.dropShipmentPSForm.select_'+i+'.checked') == true )
		{
			if ( eval('document.dropShipmentPSForm.quantityShipped1_'+i+'.value')== 0 )
			{
				tempFlag = false;
				message = "Quantity Shipped for the checked lineitem cannot be zero or blank";
			}
		}
	}
	
	flag = tempFlag;
	if ( !flag )
	{
		//document.dropShipmentPSForm.txtErrMsg1.value=message;
		pa.innerHTML = message;
		location = "#top" ;
		return;
	}

	tempFlag = true;

	for( i=0 ; i <= document.dropShipmentPSForm.lineItemCount.value-1 ; i++ )
	{
		if( eval( 'document.dropShipmentPSForm.select_'+i+'.checked') == true )
		{
			if( parseInt(eval('document.dropShipmentPSForm.quantityShipped1_'+i+'.value')) > parseInt(eval('document.dropShipmentPSForm.quantityToBeShipped_'+i+'.value')) ) 
			{
					tempFlag = false;
					var j = i;
					message += 'Quantity Shipped for the lineitem '+(j+1)+ ' cannot be greater than the Quantity To be Shipped <br>';
					eval('document.dropShipmentPSForm.quantityShipped1_'+i).value = "0";
			}
		}
	
	}

	
	flag = tempFlag;
	if ( !flag )
	{
		//document.dropShipmentPSForm.txtErrMsg1.value=message;
		pa.innerHTML = message;
		location = "#top" ;
		// eval('document.dropShipmentPSForm.quantityShipped1_'+index).focus();
		return;
	}

	flag = true;

	var deliveryTerms = document.dropShipmentPSForm.fob.value;
	if(alphanumSpecial(document.dropShipmentPSForm.fob.value,"Delivery Terms","Y")==false)
	{
		document.dropShipmentPSForm.txtErrMsg.value=errMsg;
		document.dropShipmentPSForm.fob.value = "";
		document.dropShipmentPSForm.fob.focus();
		flag = false;
	}
	else if(checkInteger(document.dropShipmentPSForm.noOfBoxes.value,"No Of Boxes","N")==false)
	{
		document.dropShipmentPSForm.txtErrMsg.value=errMsg;
		document.dropShipmentPSForm.noOfBoxes.value = "";
		document.dropShipmentPSForm.noOfBoxes.focus();
		flag = false;
	}
	else if( checkFloat( document.dropShipmentPSForm.weight.value, "Weight", "N" ) == false )
	{
		//Bhaskar added this if-else if condition for exclusive Zero validation on 30 oct 2003
		if ( document.dropShipmentPSForm.weight.value.trim() != 0 )
		{
			document.dropShipmentPSForm.txtErrMsg.value=errMsg.substring(0, 36);
			document.dropShipmentPSForm.weight.value = "";
			document.dropShipmentPSForm.weight.focus();
			flag = false;
		}
		else// if ( document.dropShipmentPSForm.weight.value.trim() == 0 )
		{
			//document.dropShipmentPSForm.weight.value = "";
			flag = true;
		}
	}

	// added by ravikanth to trim the Frieght tracking no on submit 
	if( document.dropShipmentPSForm.tracking.length == null) 
	{
		document.dropShipmentPSForm.tracking.value = document.dropShipmentPSForm.tracking.value.trim();
	}
	else
	{
		for( i=0; i < document.dropShipmentPSForm.tracking.length; i++ )
		{
			document.dropShipmentPSForm.tracking[i].value = document.dropShipmentPSForm.tracking[i].value.trim();
		}
	}

	if( flag==true )
	{
		document.dropShipmentPSForm.txtErrMsg.value="";		
		//document.dropShipmentPSForm.txtErrMsg1.value="";
		pa.innerHTML = "";
		document.dropShipmentPSForm.submit();
	}
}

function selectPackingSlip() {
    if( document.dropShipmentPSForm.customerShippingId1.value != -1 )
    {
        // changed by hareesh on 29th July 2003
        // -- START --
        //document.dropShipmentPSForm.action = "<%=chipTracContext%>/packingSlipMenu.do?action=view&customerShippingId=" + document.dropShipmentPSForm.customerShippingId1.value;
        //document.dropShipmentPSForm.submit();
         window.location = "<%=chipTracContext%>/packingSlipMenu.do?action=view&customerShippingId=" + document.dropShipmentPSForm.customerShippingId1.value;
        // -- END --
    }
}

function updatePackingSlip()
{
    document.dropShipmentPSForm.txtErrMsgDetail.value = '';
	document.dropShipmentPSForm.txtErrMsg.value = '';
    var flag = true;
	var noOfLineItemz = parseInt('<%=((List)request.getAttribute ("orderLineItemList")).size()%>');
	for( var lineNo = 0 ; lineNo < noOfLineItemz ; lineNo++)
	{
		var mktPtNum = eval ('document.dropShipmentPSForm.mktPartNumber_'+lineNo);
		var qtyPull = eval ('document.dropShipmentPSForm.qtyPulled_'+lineNo);
		var qtyShipped = eval('document.dropShipmentPSForm.quantityShipped1_'+lineNo);
		if ( parseInt(qtyPull.value) == 0 )
		{
			document.dropShipmentPSForm.txtErrMsgDetail.value = 'Select the quantity to be pulled from lots for Line Item '+(lineNo+1)+' and marketing part number '+mktPtNum.value;
			return;
		}
		if ( parseInt(qtyPull.value) != parseInt(qtyShipped.value) )
		{
			document.dropShipmentPSForm.txtErrMsgDetail.value = 'Quantity pulled and Quantity to be pulled do not match for Line Item '+(lineNo+1)+' and Marketing Part Number '+mktPtNum.value;
			return;
		}
	}
	//Bhaskar added this if condition on 30 october 2003
	/*if ( document.dropShipmentPSForm.weight.value.trim() == '' )
	{
		document.dropShipmentPSForm.txtErrMsg.value = 'Weight cannot be blank';
		document.dropShipmentPSForm.weight.focus();
		flag = false;
	}*/
    if( checkInteger( document.dropShipmentPSForm.noOfBoxes.value, "No Of Boxes", "N" ) == true )
    {
        document.dropShipmentPSForm.txtErrMsg.value='Number of boxes can not be blank';
        document.dropShipmentPSForm.noOfBoxes.value = "";
        document.dropShipmentPSForm.noOfBoxes.focus();
        flag = false;
		return;
    }

	if( checkInteger( document.dropShipmentPSForm.noOfBoxes.value, "No Of Boxes", "N" ) == false )
    {
        document.dropShipmentPSForm.txtErrMsg.value='Enter valid numbers in No Of Boxes';
        document.dropShipmentPSForm.noOfBoxes.focus();
        flag = false;
		return;
    }

    else if( checkFloat( document.dropShipmentPSForm.weight.value, "Weight", "N" ) == true )
    {
		if ( document.dropShipmentPSForm.weight.value.trim() != 0 )
		{
			document.dropShipmentPSForm.txtErrMsg.value='Please enter a value for weight';
			document.dropShipmentPSForm.weight.value = "";
			document.dropShipmentPSForm.weight.focus();
			flag = false;
		}
		else //if ( document.dropShipmentPSForm.weight.value.trim() == 0 )
		{
			//document.dropShipmentPSForm.weight.value = "";
			flag = true;
		}
    }

	if( document.dropShipmentPSForm.tracking.length == null) 
	{
		if (document.dropShipmentPSForm.tracking.value.trim().length == 0 )
		{
			document.dropShipmentPSForm.txtErrMsg.value='Frieght tracking number cannot be blank';
			document.dropShipmentPSForm.tracking.focus();
			flag = false;
		}
	}
	else
	{
		for( i=0; i < document.dropShipmentPSForm.tracking.length; i++ )
		{
			if (document.dropShipmentPSForm.tracking[i].value.trim().length == 0 )
			{
				document.dropShipmentPSForm.txtErrMsg.value='Frieght tracking number cannot be blank';
				document.dropShipmentPSForm.tracking[i].focus();
				flag = false;
			}
			
		}
	}

	// this is java script validation for the quantity shipped that shouldn't be
	//zero. 

	var noOfLineItems = 0;
	<%
		List orderLineItemList1 = (List) request.getAttribute ("orderLineItemList");
	%>
	noOfLineItems = <%= orderLineItemList1.size() %> ;

	for( var lineNo = 0 ; lineNo < noOfLineItems ; lineNo++)
	{
		var tempQty = eval("document.dropShipmentPSForm.quantityShipped_"+lineNo );
		var tempQty1 = eval("document.dropShipmentPSForm.quantityShipped1_"+lineNo);
		tempQty1.disabled = false;
		if( tempQty.value <= 0 )
		{ 
			document.dropShipmentPSForm.txtErrMsg.value="Quantity Shipped must be greater than 0";
			document.dropShipmentPSForm.txtErrMsg.focus();
			flag = false ;
		}
	}
	
    if( flag == true )
    {
        document.dropShipmentPSForm.action = "<%=chipTracContext%>/dropShipmentPS.do?action=updatePackingSlip";
		document.dropShipmentPSForm.txtErrMsg.value="";
        document.dropShipmentPSForm.submit();
    }
}

function printablePackingSlip(customerShippingId) {
    var packingSlipViewURL = '<%=chipTracContext%>/dropShipmentPS.do?action=printView&showMainMenu=false&customerShippingId=' + customerShippingId
    newWindow = window.open (packingSlipViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function sendMail( salesOrderId, customerShippingId )
{
    //newWindow = 
	window.open ('<%=chipTracContext%>/sendMail.do?salesOrderId=' + salesOrderId + '&customerShippingId=' + customerShippingId,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    //newWindow.focus();
}

function cancelAndGoBack() {
    document.dropShipmentPSForm.action = "<%=chipTracContext%>/searchDropShipmentPS.do";
    document.dropShipmentPSForm.submit();
}

function loadSalesOrder() {
    if (document.dropShipmentPSForm.salesOrderId.value != -1) {
        document.dropShipmentPSForm.action = "<%=chipTracContext%>/packingSlip.do?action=loadSalesOrder&salesOrderId=" + document.dropShipmentPSForm.salesOrderId.value;
        document.dropShipmentPSForm.submit();
    }
}

function loadSalesOrder1() {
    if (document.dropShipmentPSForm.salesOrderId1.value != -1) {
        document.dropShipmentPSForm.action = "<%=chipTracContext%>/packingSlip.do?action=loadSalesOrder&salesOrderId=" + document.dropShipmentPSForm.salesOrderId1.value;
        document.dropShipmentPSForm.submit();
    }
}

function cancelPackingSlip(customerShippingId) {
    document.dropShipmentPSForm.action = '<%=chipTracContext%>/dropShipmentPS.do?action=printView&showMainMenu=false&cancelPackingSlip=yes&customerShippingId=' + customerShippingId;
    document.dropShipmentPSForm.submit();
}

function confirmPackingSlip(customerShippingId) 
{
	var errors = false;

	if(checkInteger(document.dropShipmentPSForm.noOfBoxes.value,"No Of Boxes","Y",1000)==false)
	{	
             document.dropShipmentPSForm.txtErrMsg.value=errMsg;		 
             document.dropShipmentPSForm.noOfBoxes.value = "";
             document.dropShipmentPSForm.noOfBoxes.focus();
             errors = true;
	}
	if( typeof document.dropShipmentPSForm.tracking.length == 'undefined') 
	{
		if( document.dropShipmentPSForm.tracking.value.trim().length == 0 )
		{
			document.dropShipmentPSForm.txtErrMsg.value= " Freight Tracking No can neither be blank nor contain blank spaces";		 
			document.dropShipmentPSForm.tracking.value = "";
			document.dropShipmentPSForm.tracking.focus();
			errors = true;
		}
		else if( alphanumSpecial( document.dropShipmentPSForm.tracking.value.trim(), "Freight Tracking No", "Y" ) == false )
		{	
			document.dropShipmentPSForm.txtErrMsg.value=errMsg ;		 
			document.dropShipmentPSForm.tracking.value = "";
			document.dropShipmentPSForm.tracking.focus();
			errors = true;
		}
		else
		{
			document.dropShipmentPSForm.tracking.value = document.dropShipmentPSForm.tracking.value.trim();
		}
	}
	else
	{

		var mandatoryFlag = "N";
		var len = document.dropShipmentPSForm.tracking.length;
		for( x=0; x < len; x++ )
		{
			if( x == 0 )
			{
				mandatoryFlag = "Y";
			}
			else
			{
				mandatoryFlag = "N";
			}
			if( document.dropShipmentPSForm.tracking[x].value.trim().length == 0 && mandatoryFlag == "Y" )
			{
				document.dropShipmentPSForm.txtErrMsg.value=" Freight Tracking No can neither be blank nor contain blank spaces";	 
				document.dropShipmentPSForm.tracking[x].value = "";
				document.dropShipmentPSForm.tracking[x].focus();
				errors = true;
				break;
			}
			else if( alphanumSpecial(document.dropShipmentPSForm.tracking[x].value.trim(),"Freight Tracking No", mandatoryFlag)==false )
			{	
				document.dropShipmentPSForm.txtErrMsg.value=errMsg ;		 
				document.dropShipmentPSForm.tracking[x].value = "";
				document.dropShipmentPSForm.tracking[x].focus();
				errors = true;
				break;
			}
			else
			{
				document.dropShipmentPSForm.tracking[x].value = document.dropShipmentPSForm.tracking[x].value.trim();
			}
		}
	}

	
        if( errors == false )
	{
            document.dropShipmentPSForm.action = '<%=chipTracContext%>/packingSlip.do?action=printView&showMainMenu=false&confirmPackingSlip=yes&customerShippingId=' + customerShippingId;
            document.dropShipmentPSForm.submit();
	}
}

var dateElement = "";
function openCalendar(dateValue)
{
    dateElement = dateValue;
    
    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    //newWindow.moveTo(550,180);
    newWindow.focus();
}

function assignDate(passedValue)
{   
    dateElement.value=passedValue;
    window.focus();
}

function showCommercialInvoice( salesOrderId, customerShippingId ) 
{
    var invoiceURL = '<%=chipTracContext%>/commercialInvoice.do?action=showInvoice&salesOrderId=' + salesOrderId + '&customerShippingId=' + customerShippingId;
    newWindow = window.open (invoiceURL,'showCommercialInvoice','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function addTrackingNumberField( fontId ) 
{
    var htmltext1 = '<table style=NArialL cellspacing=0 cellpadding=0 width="100%" border=0><tr><td width="22%"><font class="NArialL"><font color=green>Freight Tracking No:</font></font></td><td width="21%">&nbsp;&nbsp;<input type=text name="tracking" class=txfield size="20" maxlength="50" /></td><td colspan=4>&nbsp;</td></tr></table>';
    var pa1 = document.getElementById (fontId);
    pa1.insertAdjacentHTML ('BeforeEnd',htmltext1);
}

function showErrorReportPage()
{
    newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
    newWindow.focus();
}

</SCRIPT>

<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@include file="/jsp/operations/operations_menu.jsp" %>
<!-- end of the side navigations -->


<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- body starts -->

<table border='0' align='center' width='98%'>
<tr><td align='center' valign='center' width='80%'><font class="NArialW">Drop Shipment Packing Slip</font>
<%
    if (viewPackingSlip) {
        PackingSlipForm dropShipmentPSForm = (PackingSlipForm) request.getAttribute ("dropShipmentPSForm");
        int customerShippingId = dropShipmentPSForm.getCustomerShippingId();
        int salesOrderId = dropShipmentPSForm.getSalesOrderId();
%>
        <br><font align=right class="NArialS"><a href="javascript:sendMail( <%=salesOrderId%>, <%=customerShippingId%> );" title='Click here to send mail'><b>[E-mail this Packing Slip]</b></a>&nbsp;&nbsp;
        <% if ( user.isActionAllowed ( Functionality.COMMERCIAL_INVOICE, User.USER_ACTION_VIEW ) ) { %>
        &nbsp;&nbsp;<font class="NArialS"><a href="javascript:showCommercialInvoice( <%=salesOrderId%>, <%=customerShippingId%>);" onMouseOver="window.status='Commercical Invoice';return true" onMouseOut="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>[Commercial Invoice]</b></a>&nbsp;&nbsp;</font>
        <% } else { %>
        &nbsp;&nbsp;<font class="NArialS" color='blue'><b>[Commercial Invoice]</b>&nbsp;&nbsp;</font>
        <% } %>
        &nbsp;&nbsp;<font class="NArialS"><a href="javascript:printablePackingSlip(<%=customerShippingId%>);" onMouseOver="window.status='Printer-Friendly Version';return true" onMouseOut="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>[Printer-Friendly Version]</b></a>&nbsp;&nbsp;</font>
        &nbsp;&nbsp;<font class="NArialS"><a href="javascript:cancelPackingSlip(<%=customerShippingId%>);" onMouseOver="window.status='Cancel This Packing Slip';return true" onMouseOut="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>[Cancel This Packing Slip]</b></a>&nbsp;&nbsp;</font>
        &nbsp;&nbsp;<!--font class="NArialS"><a href="javascript:confirmPackingSlip(<%=customerShippingId%>);" onMouseOver="window.status='Conform This Packing Slip';return true" onMouseOut="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>[Confirm This Shipment]</b></a>&nbsp;&nbsp;</font-->
<%
    }
%>
    </td>
</tr>

</table>

<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>

<html:form name="dropShipmentPSForm" type="com.scalar.chiptrack.operations.packingslip.forms.PackingSlipForm" action="/dropShipmentPS.do?action=save">
<html:hidden name="dropShipmentPSForm" property="customerShippingId"/>
<!--input type='hidden' name='autoConfirmPackingSlip' value='<%=request.getAttribute ("AUTO_CONFIRM_PACKING_SLIP")%>'/-->
<!--input type='hidden' name='viewonly' value='<%=viewPackingSlip%>'/-->

<table border="0" width="90%" align="top">
<% if ( !user.isActionAllowed ( Functionality.PACKING_SLIP, User.USER_ACTION_MODIFY  )  ) { %> 
<tr><td><font class='NArialS'><font color='blue'>
<b><%=Constants.NO_MODIFY_RIGHTS %></b>
</font><td><tr>  
<% } %>
<TR><TD width="50%" valign="top">
<INPUT align=left border=0 
                        maxLength=100 name="txtErrMsg" size=100 
                        style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: arial;font-size: 10pt;font-weight:bold " value="" readOnly>
</TD></TR>

</TABLE>
   <table border="0" width="90%" align=right class='NArialL'>

    <tr>
       <td width="21%"><font class="NArialL">PackingSlip Label:</font></td>
       <td width="21%">
        <%
            // Changed by hareesh on 29th August 2003
            // -- START --
           // if (viewPackingSlip) {
        %>
                <html:text disabled="true" name="dropShipmentPSForm"  property="label" size="20" maxlength="50" styleClass="disabledtxfield"/>
                <html:hidden name="dropShipmentPSForm" property="label"/>
        <%
            //} else {
        %>
                <!--html:text name="dropShipmentPSForm"  property="label" size="20" maxlength="50" styleClass="txfield"/-->
        <%
            //}
            // -- END --
        %>

        <td width="3%">&nbsp;</td>
        <%
            ArrayList packingSlipListBySalesOrderId = (ArrayList) request.getAttribute ("packingSlipListBySalesOrderId");
            if (packingSlipListBySalesOrderId == null) packingSlipListBySalesOrderId = new ArrayList();
            int packingSlipListBySalesOrderIdSize = packingSlipListBySalesOrderId.size();

            if (packingSlipListBySalesOrderIdSize > 0) {
        %>
                <td width="21%"><font class="NArialL">Other Packing Slips:</font>&nbsp;</td>
                <td width="21%"><select name="customerShippingId1" onchange="selectPackingSlip()" class='NArialL'>
                <option value='-1' selected>-- Other Packingslips --</option>
        <%
                PackingSlipForm packingSlip = null;
                String label = null;

                for (int i=0; i<packingSlipListBySalesOrderIdSize; i++) {
                    packingSlip = (PackingSlipForm) packingSlipListBySalesOrderId.get (i);
                    label = packingSlip.getLabel();

                    out.print ("<option value='" + packingSlip.getCustomerShippingId() + "'> " + label);
                }
        %>
            <input type="hidden" name="packingSlipSalesOrderId" value='<%=packingSlip.getSalesOrderId()%>'>
            </select>
            <td>
        <%
            }
        %>
        </tr>


     <tr>
       <td width="21%"><font class="NArialL">Customer PO:</font></td>
       <td width="21%"><html:text disabled="true" name="dropShipmentPSForm"  property="customerPO" size="20" styleClass="disabledtxfield"/>
       </td>       
        <td width="3%">&nbsp;</td>
        <td width="21%"><font class="NArialL">Sales Order No:</font></td>
       <td width="21%">
            <html:text disabled="true" name="dropShipmentPSForm"  property="salesOrderNumber" size="20" styleClass="disabledtxfield"/>
            <html:hidden name="dropShipmentPSForm" property="salesOrderNumber"/>
            <html:hidden name="dropShipmentPSForm" property="salesOrderId"/>
       </td>
        <td width="3%">&nbsp;</td>
    </tr>

     <tr>

        <td width="21%"><font class="NArialL">Customer Name:</font></td>
        <td width="21%">
            <html:text disabled="true" name="dropShipmentPSForm"  property="customerName" size="20" maxlength="50" styleClass="disabledtxfield"/>
            <html:hidden name="dropShipmentPSForm" property="customerName"/>
            <html:hidden name="dropShipmentPSForm" property="customerPO"/>
        </td>
        <td width="3%">&nbsp;</td>

       <td width="21%"><font class="NArialL">Shipping Contact Person:</font></td>
       <td width="21%">
            <html:text name="dropShipmentPSForm"  property="contactPerson" size="20" maxlength="50" styleClass="txfield"/>
       </td>
       <td width="3%">&nbsp;</td>
    </tr>

    <tr>
       <td width="21%"><font class="NArialL">Regional Rep:</font></td>
       <td width="21%">
            <html:text name="dropShipmentPSForm"  disabled="true" property="repOffice" size="20" maxlength="50" styleClass="disabledtxfield"/>
            <html:hidden name="dropShipmentPSForm" property="repOffice"/>
       </td>
       <td width="3%">&nbsp;</td>

	   <td width="21%"><font class="NArialL">Weight:</font><!--font color="RED" size="1"><B>*</B></font--></td>
       <td width="21%">
			<html:text name="dropShipmentPSForm"  property="weight" size="20" maxlength="50" styleClass="txfield"/> (Lbs)
       </td>
	   <td width="3%">&nbsp;</td>
     </tr>
     <tr>
	   <td width="21%"><font class="NArialL">Delivery Terms:</font><font color="RED" size="1"><B>*</B></font>
           </td>
       
        <td width="21%">
            <% if (viewPackingSlip) { %>
                    <html:text name="dropShipmentPSForm"  property="fob" disabled="true" size="20" maxlength="50" styleClass="disabledtxfield"/>
                    <html:hidden name="dropShipmentPSForm" property="fob" />
            <% } else { %>
                    <html:text name="dropShipmentPSForm"  property="fob" size="20" maxlength="50" styleClass="txfield"/>
            <% } %>
       </td>

       <td width="3%">&nbsp;</td>

	   <td width="21%"><font class="NArialL">No. Of Boxes:</font><font color="RED" size="1"><B><%=!viewPackingSlip ? "":"*" %><B></font></td>
       <td width="21%">
            <html:text name="dropShipmentPSForm"  property="noOfBoxes" size="20" maxlength="10" styleClass="txfield"/>
       </td>
	   <td width="3%">&nbsp;</td>
     </tr>

    <tr>
        <td width="21%">
            <font class="NArialL">Freight Tracking No:</font><font color="RED" size="1">
            <B><%=!viewPackingSlip ? "":"*" %></B></font>
        </td>
       <td width="21%" valign=center>
       <%
            PackingSlipForm dropShipmentPSForm = ( PackingSlipForm ) request.getAttribute( "dropShipmentPSForm" );
            String[] trackingNumbers = dropShipmentPSForm.getTracking();

            String firstTrackingNumber = "";

            if( ( trackingNumbers != null ) && 
                ( trackingNumbers.length >= 1) && 
                ( trackingNumbers[0] != null ) && 
                ( trackingNumbers[0].trim().length() != 0 ) )
            {
                firstTrackingNumber = trackingNumbers[0];
            }
       %>

            <input type=text name="tracking" size="20" maxlength="50" class="txfield" value='<%=firstTrackingNumber%>' />
            <a href="javascript:addTrackingNumberField('font1');" title='Click here to add new Trackig Number'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a>
       </td>
       <td width="3%">&nbsp;</td>

        <td width="21%"><font class="NArialL">Shipped VIA:</font></td>
        <td width="21%">
            <html:text   name="dropShipmentPSForm"  property="shippedVia" size="20" maxlength="50" styleClass="txfield"/>
            <html:hidden name="dropShipmentPSForm" property="shippedVia" />
            <html:hidden name="dropShipmentPSForm" property="shippingMethod" />
            <html:hidden name="dropShipmentPSForm" property="shippingAccount" />
        </td>
	<td width="3%">&nbsp;</td>
    </tr>

    <!-- show all other tracking numbers -->
    <%
        if( ( trackingNumbers != null ) && ( trackingNumbers.length >= 2 ) )
        {
            for( int i = 1; i < trackingNumbers.length; i++ )
            {
    %>
                <tr><td colspan='6'>
                    <table style=NArialL cellspacing=0 cellpadding=0 width="100%" border=0>
                        <tr>
                            <td width="22%"><font class="NArialL">Freight Tracking No:</font></td>
                            <td width="21%">&nbsp;&nbsp;<input type=text name="tracking" class=txfield size="20" maxlength="50" value='<%=trackingNumbers[i]%>'/></td>
                            <td colspan=4>&nbsp;</td>
                        </tr>
                    </table>
                </td></tr>
    <%
            }
        }
    %>

    <!-- add tracking number fields -->
    <tr><td colspan='6'><font id="font1"></font></td></tr>


<!--
    <table><tr>
        <td width="21%"><font class="NArialL">Freight Tracking No:</font></td>
        <td width="21%"><input type=text name="tracking" size="20" maxlength="50" /></td>
        <td colspan='4'>&nbsp;</td>
    </tr></table>
-->


	 <tr>
	   <td width="21%"><font class="NArialL">Billing Address:</font></td>
	   <td width="21%">
                <html:textarea disabled="true" rows="5" name="dropShipmentPSForm" property="billingAddress" cols="20" styleClass="disabledtxfield"/>
                <html:hidden name="dropShipmentPSForm" property="billingAddress" />

           </td>
	   <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Shipping Address:</font></td>
       <td width="21%"><html:textarea disabled="true" rows="5" name="dropShipmentPSForm" property="shippingAddress" cols="20" styleClass="disabledtxfield"/>
                       <html:hidden name="dropShipmentPSForm" property="shippingAddress" /> 
                       <html:hidden name="dropShipmentPSForm" property="shippingToAddressId" />
                       <html:hidden name="dropShipmentPSForm" property="shippingFromAddressId" />
       </td>
       <td width="3%">&nbsp;</td>
	 </tr>


        <tr>
            <td width="21%"><font class="NArialL">Actual Ship Date (mm/dd/yyyy):</font></td>
            <td width="21%">
            <html:text name="dropShipmentPSForm"  property="shipDate" size="11" maxlength="10" styleClass="txfield"/>
            <a href="javascript:openCalendar(document.dropShipmentPSForm.shipDate)">
            <img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20>
            </a> 
            </td>
            <td width="3%">&nbsp;</td>
            <td width="21%" class="NArialL">Invoice #:</td>
            <td width="21%"><html:text name="dropShipmentPSForm" property="invNo" maxlength="50" styleClass="txfield"/></td>
	   <td width="3%">&nbsp;</td>
	 </tr>
         
        <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
        
	 <tr><td colspan="2">
	 	<font class="NArialL">Shipping Instructions:</font><br>
                <%
                    if (viewPackingSlip) {
                %>
                        <html:textarea rows="4" name="dropShipmentPSForm" disabled="true" property="shippingInstructions" cols="60" styleClass="disabledtxfield"/>
                        <html:hidden name="dropShipmentPSForm" property="shippingInstructions" />
                <%
                    }
                    else {
                %>
                        <html:textarea rows="4" name="dropShipmentPSForm" property="shippingInstructions" cols="60" styleClass="txfield"/>
                <%
                    }
                %>
	 	
	 </td>	   
	 
	 <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Shipping Location:</font></td>
       <td width="21%">
			<html:select property="shippingFromLocationId" name="dropShipmentPSForm" styleClass="txfield" disabled='<%=viewPackingSlip?true:false%>'>
			<html:option value="-1">Select a Location</html:option>
			<html:options collection="locations" property="value" labelProperty="label"/>
			</html:select>
	   </td>
       <td width="3%">&nbsp;</td>
	 </tr>
	 <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
         <tr><td colspan=6><chiptrack:errors styleClass="NArialL"/></td></tr>
         <tr><td colspan=6><a name="#top"/> <!--INPUT align=left border=0 
                        maxLength=1000 name="txtErrMsg1" size=100 
                        style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: arial;font-size: 10pt;font-weight:bold " value="" readOnly wrap-->
			 <FONT id="txtErrMsg1" size="2pt" color='FF0000' face="Arial"></font>
		</td></tr>		     

         <tr><td colspan=6>
        <INPUT align=left border=0 
                                maxLength=125 name="txtErrMsgDetail" size=125 
                                style="BORDER-BOTTOM: thin; BORDER-LEFT-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-TOP: thin; CLEAR: none; COLOR: red;font-family: arial;font-size: 10pt;font-weight:bold " value="" readOnly>
        </TD></TR>
         <tr><td colspan='6' class='NArialL'><FONT id="errors1" size="-2" color='FF0000'></FONT></td></tr>
	 <tr><td colspan=6>
		<table border="0" width="98%" bordercolor="#FFFFFF">
	     <tr>
		   <td width="4%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Select</font></td>
	       <td width="4%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Line Item</font></td>
           <% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MFG_PARTNO_PACKINGSLIP ) ) { %>
	       <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key = "label.mfgPartNumber" />
		   </font></td>
           <%  } if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MRKT_PARTNO_PACKINGSLIP ) ) { %>
             <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key = "label.mktgPartNumber" />
		   </font></td>
           <% } %>
	       <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF"><bean:message key = "label.customerPartNumber" />
		   <!-- Customer Part Number --></font></td>
	       <td width="20%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Description</font></td>
	       <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Unit Type</font></td>
	       <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Req. Dock Date</font></td>
	       <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Sch. Ship Date</font></td>
	       <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Requested Quantity</font></td>
               <td width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Quantity To be Shipped</font></td>
	       <td colspan='<%=!viewPackingSlip ? "1" : "2"%>' width="10%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Quantity Shipped</font></td>
               <td width="8%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Status</font></td>
	    </tr>

            <%
                List orderLineItemList = (List) request.getAttribute ("orderLineItemList");
                if (orderLineItemList == null) orderLineItemList = new ArrayList();

                HashMap csLineItemMap = (HashMap) request.getAttribute ("customerShippingLineItemMap");
                if (csLineItemMap == null) csLineItemMap = new HashMap();

                LineItem lineItem = null;
                CustomerShippingLineItem csLineItem = null;
                int size = orderLineItemList.size();

                String bgColor="#FFFFFF";

                HashMap qtyToBeShippedList = new HashMap();
                HashMap requestedQtyList = new HashMap();
                for (int i=0; i <= (size-1); i++) {

                    if (bgColor.equalsIgnoreCase ("#FFFFFF")) bgColor = "#DEE1E2";
                    else if (bgColor.equalsIgnoreCase ("#DEE1E2")) bgColor = "#FFFFFF";

                    lineItem = (LineItem) orderLineItemList.get (i);
                    csLineItem = (CustomerShippingLineItem) csLineItemMap.get (lineItem.getLineItemId()+"");
                    requestedQtyList.put(i+"",lineItem.getQuantity()+"" );

                    String description = null;
                    if( csLineItem != null )
                    {
                        description = csLineItem.getDescription();
                    }

                    // Balaram, June 23, 2003
                    if( ( ( description == null ) || ( description.trim().length() == 0 ) ) && ( lineItem != null ) )
                    {
                        description = lineItem.getDescription();
                    }

                    if( ( description == null ) || ( description.equalsIgnoreCase( "null" ) ) )
                    {
                        description = "";
                    }

                      String customerPartNumber = null;
                    if(csLineItem != null)
                        customerPartNumber = csLineItem.getCustomerPartNumber();
                    if((customerPartNumber == null) || ((customerPartNumber != null) && (customerPartNumber.equalsIgnoreCase("null"))))
                        customerPartNumber = "";

					//Bhaskar added this units block on 28 Jan 2004
					String units = null;
					if(csLineItem != null)
					units = csLineItem.getUnits();
					if((units == null) || ((units != null) && (units.equalsIgnoreCase("null"))))
					units = "";

			%>
                <tr>

                    <%//if (!viewPackingSlip) {%>
                    <td width="4%" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL">
                        <!--input type="checkbox" <%if ((csLineItem != null) && (csLineItem.getStatus().equalsIgnoreCase (Constants.CUSTOMER_SHIPPING_STATUS_ISSED))) out.print ("disabled");%> name='<%="select_"+i%>' class=""></font-->
                        <input type="checkbox" name='<%="select_"+i%>' <%if (viewPackingSlip) out.print(" checked disabled");%> class="NArialL"></font>
                        <%if (viewPackingSlip) {%><input type=hidden name='<%="select_"+i%>' checked/><%}%>
                    </td>
                    <%//}%>
                    <td width="4%" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL"><%=lineItem.getLineItemNo()%></font>
                        <input type="hidden" name='<%="id_"+i%>' value='<%if (csLineItem != null) out.print (csLineItem.getId());%>'>
                        <input type="hidden" name='<%="lineItemId_"+i%>' value='<%=lineItem.getLineItemId()%>'>
                        <input type="hidden" name='<%="lineItemNumber_"+i%>' value='<%=lineItem.getLineItemNo()%>'>
                    </td>
                    <input type="hidden" name='<%="mktPartNumber_"+i%>' value="<%=lineItem.getMarketingPartNo()%>">
                    <% if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MFG_PARTNO_PACKINGSLIP ) ) { %>
                    <td width="15%" align="center" bgcolor='<%=bgColor%>' nowrap>
                        <font class="NArialL"><%=lineItem.getManufacturingPartNo()%></font>
                    </td>
                    <%  } if (ConfigManager.getBooleanProperty(ConfigManager.SHOW_MRKT_PARTNO_PACKINGSLIP ) ) { %>
                    <td width="15%" align="center" bgcolor='<%=bgColor%>' nowrap>
                        <font class="NArialL"><%=lineItem.getMarketingPartNo()%></font>
                    </td>
                    <% } %>
                    <td width="15%" align="center" bgcolor='<%=bgColor%>' nowrap>
						<input type="text" name=<%="customerPartNumber_"+i%> size='15' maxlength='50' class='txfield'
							value="<%=customerPartNumber%>">  
                    </td>
                    <td width="240" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL"><textarea name='<%="description_"+i%>' class="txfield" rows='3' cols='20'><%=description%></textarea></font>
                    </td>
                    <td width="15%" align="center" bgcolor='<%=bgColor%>' nowrap>
                    <!--
                        <font class="NArialL"><%=lineItem.getManufacturingPartNo()%></font>
                        -->
                      <input type="text" align='right' name='<%="units_"+i%>' size="8" maxlength="50" class='txfield' value='<%=units%>'>
                    </td>
                    <td width="10%" align="right" bgcolor='<%=bgColor%>' nowrap>
                        <font class="NArialL"><%=lineItem.getRequestDate()%></font>
                    </td>
                    <td width="10%" align="right" bgcolor='<%=bgColor%>' nowrap>
                        <font class="NArialL"><%=lineItem.getScheduleDate()%></font>
                    </td>

                    <%
                        /*String shippedDate = null;
                        if (csLineItem != null) {
                            shippedDate = csLineItem.getShippedDate();
                        }
                        if ((shippedDate == null) || ("null".equalsIgnoreCase (shippedDate))) {
                            shippedDate = lineItem.getScheduleDate();
                        }*/
                    %>
                    <!--td width="10%" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL"><input type='text' name='shippedDate_"+i' size='8' class='txfield' value='shippedDate'></font>
                    </td-->
                    <td width="10%" align="right" bgcolor='<%=bgColor%>' nowrap>
                    <%
                        int requestedQuantity = lineItem.getQuantity();
                        int quantityToBeShipped = -1;

                        if (csLineItem != null) {
                            quantityToBeShipped = csLineItem.getQtyToBeShipped();
                        }
                        
                        //if ((!viewPackingSlip) && (quantityToBeShipped != -1)) {
                        if (quantityToBeShipped != -1) {
                            requestedQuantity = quantityToBeShipped;
                        }
                        
                       
                    %>
                        <font class="NArialL"><%=StringUtils.formatUnits(lineItem.getQuantity())%></font>
                                              <input type="hidden" name='<%="quantityRequested_"+i%>' value="<%=requestedQuantity%>">
                    </td>

                    <td width="10%" align="right" bgcolor='<%=bgColor%>'>
                        <font class="NArialL">
                        <%
                            if (csLineItem != null) {
                                qtyToBeShippedList.put (i+"", csLineItem.getQtyToBeShipped()+"");
                                out.print (StringUtils.formatUnits(csLineItem.getQtyToBeShipped())); 
                            }
                            else {
                                qtyToBeShippedList.put (i+"", requestedQuantity+"");
                                out.print (StringUtils.formatUnits(requestedQuantity));
                            }
                        %>
                        
                        <input type="hidden" name='<%="quantityToBeShipped_"+i%>' value='<%if (csLineItem != null) out.print(csLineItem.getQtyToBeShipped()); else out.print (requestedQuantity);%>'>
                        </font>
                    </td>

                    <td width="10%" align=center bgcolor='<%=bgColor%>' <%//if (viewPackingSlip) out.print ("colspan=2");%> >
                        <font class="NArialL">
						<input type="hidden" name='<%="qtyPulled_"+i%>' value="0">
						<input type="hidden" name='<%="quantityShipped_"+i%>' value='<%if (csLineItem != null) out.print (csLineItem.getQtyShipped());%>'>
                        <input type="hidden" name='<%="previousQuantityShipped_"+i%>' value='<%if (csLineItem != null) out.print (csLineItem.getQtyShipped());%>'>
                        <input type="text" align='right' name='<%="quantityShipped1_"+i%>' size="8" class='valuetxfield' value='<%if (csLineItem != null) out.print (StringUtils.formatUnits(csLineItem.getQtyShipped())); else out.print ("0");%>'>
						<!--Bhaskar commented the old code and placed the new one.-->
                        <!--input type="text" align='right' < %=!viewPackingSlip ? "": "disabled"%> name='< % ="quantityShipped1_"+i%>' size="8" class='valuetxfield' value='< %if (csLineItem != null) out.print (StringUtils.formatUnits(csLineItem.getQtyShipped())); else out.print ("0");%>'-->
                        </font>
                    </td>

                    <%if (viewPackingSlip) {%>
                    <td width="2%" align="right" bgcolor='<%=bgColor%>'>
                    <%
                        //if ((!viewPackingSlip) || (((csLineItem != null) && (csLineItem.getStatus().equalsIgnoreCase (Constants.CUSTOMER_SHIPPING_STATUS_ISSED))) == false)) {
                        int csLineItemId = -1;
                        if (csLineItem != null) {
                            csLineItemId = csLineItem.getId();
                        }
						
                        String filedName = "quantityShipped_" + i;
                        String filedName1 = "quantityShipped1_" + i;
                    %>
                        <!--chiptrack:lotQtyPull partNumber='< %=lineItem.getManufacturingPartNo()%>' lineItemId='< %=lineItem.getLineItemId()%>' csLineItemId=' < %=csLineItemId%>' -->
						<A href="javascript:openInventory('<%=lineItem.getManufacturingPartNo()%>', '<%=lineItem.getLineItemId()%>', '<%=filedName%>', '<%=filedName1%>', '<%=csLineItemId%>', <%=(String) qtyToBeShippedList.get(i+"")%>, <%=(String) requestedQtyList.get(i+"")%>,'<%if (csLineItem != null ) out.print (csLineItem.getQtyShipped());%>',<%=i%>);" onMouseOver="window.status='Click here to see the final finished goods and their locations';return true" onMouseOut="window.status='';return true">
                            <img border='0' alt="Click here to select inventory" height='12' width='16' src="<%=chipTracContext%>/jsp/includes/images/arrow.gif">
                            </A>
                        <!--/chiptrack:lotQtyPull-->
						
                        <!--chiptrack:lotQtyPull partNumber='< %=lineItem.getManufacturingPartNo()%>' lineItemId='< %=lineItem.getLineItemId()%>' csLineItemId='< %=csLineItemId%>' inverseFunctionality='true'>
                            <img border='0' alt="No inventory found for < %=lineItem.getManufacturingPartNo()%> " height='12' width='16' src="< %=chipTracContext%>/jsp/includes/images/cancel_icon.gif" -->
                        <%--</chiptrack:lotQtyPull>--%>
                    </td>                        
					<% } %>
                    <!-- td width="8%" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL"><input type="text" name="balance" size="8" disabled class="disabledtxfield" value='<%if (csLineItem != null) out.print (requestedQuantity-csLineItem.getQtyShipped());%>'></font>
                    </td-->
                    <td width="8%" align="center" bgcolor='<%=bgColor%>'>
                        <font class="NArialL"><%if (!viewPackingSlip) out.print("OPEN"); else if (csLineItem != null) out.print (csLineItem.getStatus());%></font>
                    </td>
                </tr>
            <%
                }
            %>
	    <input type="hidden" name="lineItemCount" value='<%=size%>'>
            <tr><td colspan=9><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
	   </table>
	 </td></tr>
	 <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
	 <tr><td colspan=6 align=center>


        <%
            String hrefLink = "javascript:generatePackingSlip();";
            if (viewPackingSlip) hrefLink="javascript:updatePackingSlip();";
        %>

           <chiptrack:restrictedLink functionality='<%=Functionality.PACKING_SLIP%>' action='<%=User.USER_ACTION_MODIFY%>' href='<%=hrefLink%>' onmouseover="window.status='Click here to save drop shipment packing slip';return true" onmouseout="window.status='';return true">
           <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif"></chiptrack:restrictedLink>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	   <a href="javascript:cancelAndGoBack();" onMouseOver="window.status='Click here to go back to drop shipping menu';return true" onMouseOut="window.status='';return true"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></a>
      </td></tr>

    <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
	<tr><td colspan=6><img border='0' height='16' width='20' src="<%=chipTracContext%>/jsp/includes/images/arrow.gif">  Indicates Inventory can be Pulled for the Packing Slip</td></tr><tr><td colspan=6><img border='0' height='16' width='20' src="<%=chipTracContext%>/jsp/includes/images/cancel_icon.gif"> Indicates no inventory available for the Part number</td></tr>
	<tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    </table>
<%
 session.putValue("requestedQuantity",requestedQtyList);
%>
</html:form>

<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=40 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</body>

</html:html>
